package com.flow.asyncflow.core.node;


import com.flow.asyncflow.core.annotation.NodeInfo;
import com.flow.asyncflow.core.entity.config.AsyncFlowInfo;
import com.flow.asyncflow.core.entity.core.*;
import com.flow.asyncflow.core.enums.ExecuteEnum;
import com.flow.asyncflow.core.utils.log.asyncflowlog.AsyncFlowCommon_Log;
import com.flow.asyncflow.core.utils.msg.AsyncFlowSendMsg;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.StopWatch;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.LinkedHashMap;

@NodeInfo(name = "测试环境记录节点上下文")
public class AsyncFlowBaseGetData implements IFlowNode {

    @Override
    public AsyncFlowNodeResponse execute(AsyncFlowContext asyncFlowData) {
        AsyncFlowNodeResponse flowResponse = new AsyncFlowNodeResponse(200, "执行成功.");
        AsyncFlowRequest asyncFlowRequest = asyncFlowData.getAsyncFlowRequest(AsyncFlowRequest.class);

        if (!asyncFlowData.getAsyncFlowInfo().getEvn().equals("stage") &&! asyncFlowData.getAsyncFlowInfo().getEvn().equals("test")) {
            flowResponse.setIgnoreNodeTrackLog(true);
            flowResponse.setMsg("正式环境不记录上下文日志");
            return flowResponse;
        }
        AsyncFlowCommon_Log.AddAsyncFlowDetailLog(asyncFlowData, "AsyncFlowBaseGetData", "节点上下文", asyncFlowRequest, asyncFlowData.getDataSourceMap(), true);
        return flowResponse;
    }
}
